<template>
  <view>
    <button @click="setSrc">setSrc</button>
    <button @click="play">play</button>
    <button @click="seek">seek</button>
    <button @click="pause">pause</button>
  </view>
</template>

<script>
let manager

export default {
  onReady () {
    manager = uni.getBackgroundAudioManager()
    manager.onPlay(() => {
      console.log('onPlay')
    })
    manager.onTimeUpdate(() => {
      console.log('onTimeUpdate')
    })
    manager.onPause(() => {
      console.log('onPause')
    })
    console.log(manager)
  },
  methods: {
    setSrc () {
      manager.src = 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3'
      return 'success'
    },
    play () {
      manager.play()
      return 'success'
    },
    seek () {
      manager.seek(0)
      return 'success'
    },
    pause () {
      manager.pause()
      return 'success'
    }
  }
}
</script>

<style>
</style>